import 'package:flutter/material.dart';
import 'package:hkzf_flutter/scoped_model/auth_model.dart';
import 'package:hkzf_flutter/utils/common_toast.dart';
import 'package:hkzf_flutter/utils/scoped_model_helper.dart';

class SettingPage extends StatelessWidget {
  const SettingPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("设置"),
      ),
      body: ListView(
        children: [
          ElevatedButton(
            style: ElevatedButton.styleFrom(
              backgroundColor: Colors.green, // 设置按钮颜色
              foregroundColor: Colors.white, // 设置按钮文字颜色
            ),
            onPressed: () {
              // 清除状态管理里面的token信息
              ScopedModelHelper.getModel<AuthModel>(context).logout();
              CommonToast.showToast('已经退出登录');
            },
            child: const Text('退出登录')
          ),
        ],
      ),
    );
  }
}
